package com.youpingou.config;

import com.youpingou.util.IdWorker;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @auther Created by yuanxinqi 
 */
@Data
@Configuration
@ConfigurationProperties(prefix = "sc.idworker")
public class IdWorkerProperties {

    private long workerId;
    private long datacenterId;

    @Bean
    public IdWorker getIdWorker(){
        return new IdWorker(workerId,datacenterId);
    }

}